#ifndef _INCLUDE_RINGBUF_H
#define _INCLUDE_RINGBUF_H
#include <stdint.h>

typedef struct ringbuf
{
    uint8_t *data;
    uint32_t size;
    uint32_t head;
    uint32_t tail;
    uint32_t flip;
}ringbuf_t;
    
void ringbuf_init(ringbuf_t *rbuf, uint8_t *buf, uint32_t size);
uint32_t ringbuf_data_size(ringbuf_t *rbuf);
uint32_t ringbuf_free_size(ringbuf_t *rbuf);
uint32_t ringbuf_put(ringbuf_t *rbuf, uint8_t *buf, uint32_t num);
uint32_t ringbuf_get(ringbuf_t *rbuf, uint8_t *buf, uint32_t num);

#endif//_INCLUDE_RINGBUF_H
